package us.icitap.timsportal.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * Entity implementation class for Entity: Role
 *
 */
@Entity
@Table(schema="TIMSPORTAL", name="ROLE")
public class Role implements Serializable {

	
	/**
	 * 
	 */
	private static final long serialVersionUID = -6148113896557656969L;
	
	@Id
	//@Enumerated(EnumType.STRING)
	@Column(name="ID", length=50)
	private String id;
	@Column(name="TAG", length=150)
	private String tag;
	@JoinColumn(name="MODULE_ID")
	@ManyToOne(fetch=FetchType.EAGER)
	private Module module;
	private String description;
	@Column(name="RECORD_DATE")
	@Temporal( TemporalType.TIMESTAMP)
	private Date recordDate;
	@Column(name="RECORD_USER")
	private String recordUser;
	private boolean status;

	public Role() {
		super();
	}   
  
	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}
	
	
	public Date getRecordDate() {
		return this.recordDate;
	}

	public void setRecordDate(Date recordDate) {
		this.recordDate = recordDate;
	}
	
	public String getRecordUser() {
		return this.recordUser;
	}

	public void setRecordUser(String recordUser) {
		this.recordUser = recordUser;
	}   
	public boolean getStatus() {
		return this.status;
	}

	public void setStatus(boolean status) {
		this.status = status;
	}

	public Module getModule() {
		return module;
	}
	public void setModule(Module module) {
		this.module = module;
	}

	public String getTag() {
		return tag;
	}

	public void setTag(String tag) {
		this.tag = tag;
	}
	
	@Override
	public String toString() {
		return id;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((description == null) ? 0 : description.hashCode());
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		result = prime * result
				+ ((recordDate == null) ? 0 : recordDate.hashCode());
		result = prime * result
				+ ((recordUser == null) ? 0 : recordUser.hashCode());
		result = prime * result + (status ? 1231 : 1237);
		result = prime * result + ((tag == null) ? 0 : tag.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (!(obj instanceof Role))
			return false;
		Role other = (Role) obj;
		if (description == null) {
			if (other.description != null)
				return false;
		} else if (!description.equals(other.description))
			return false;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		if (recordDate == null) {
			if (other.recordDate != null)
				return false;
		} else if (!recordDate.equals(other.recordDate))
			return false;
		if (recordUser == null) {
			if (other.recordUser != null)
				return false;
		} else if (!recordUser.equals(other.recordUser))
			return false;
		if (status != other.status)
			return false;
		if (tag == null) {
			if (other.tag != null)
				return false;
		} else if (!tag.equals(other.tag))
			return false;
		return true;
	}
   
}
